package t2.client.events;

import com.google.gwt.event.shared.GwtEvent;

public class SendDataEvent extends GwtEvent<SendDataHandler>{

    public static Type<SendDataHandler> TYPE = new Type<SendDataHandler>();
    
    private int frameId;
    private int[] addr64;
    private int[] addr16;
    private int[] payload;
    private int sourceEndpoint;
    private int destEndpoint;
    
    /* Constructor */
    public SendDataEvent(int frameId, int[] addr64, int[] addr16, int[] payload, int sourceEndpoint, int destEndpoint){
        setFrameId(frameId);
        setAddr64(addr64);
        setAddr16(addr16);
        setPayload(payload);
        setSourceEndpoint(sourceEndpoint);
        setDestEndpoint(destEndpoint);
    }
    
    public SendDataEvent(int[] addr64, int[] payload){
        setAddr64(addr64);
        setPayload(payload);
    }

    @Override
    public com.google.gwt.event.shared.GwtEvent.Type<SendDataHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(SendDataHandler handler) {
        handler.txData(this);
    }

    public int getFrameId() {
        return frameId;
    }

    public void setFrameId(int frameId) {
        this.frameId = frameId;
    }

    public int[] getAddr64() {
        return addr64;
    }

    public void setAddr64(int[] addr64) {
        this.addr64 = addr64;
    }

    public int[] getAddr16() {
        return addr16;
    }

    public void setAddr16(int[] addr16) {
        this.addr16 = addr16;
    }

    public int[] getPayload() {
        return payload;
    }

    public void setPayload(int[] payload) {
        this.payload = payload;
    }

    public int getSourceEndpoint() {
        return sourceEndpoint;
    }

    public void setSourceEndpoint(int sourceEndpoint) {
        this.sourceEndpoint = sourceEndpoint;
    }

    public int getDestEndpoint() {
        return destEndpoint;
    }

    public void setDestEndpoint(int destEndpoint) {
        this.destEndpoint = destEndpoint;
    }
}
